﻿<div id="EventsIndex" ng-controller="app.views.events.index as vm">
    <h2>
        <span>@L("Events")</span>
        <a ng-click="vm.openNewEventDialog()" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> @L("NewEvent")</a>
        <span class="pull-right event-filters">
            <input type="checkbox" ng-model="vm.filters.includeCanceledEvents" /> @L("ShowCanceledEvents")
        </span>
    </h2>
    <div class="row">
        <div ng-repeat="event in vm.events" class="event-list-item col-md-6">
            <div class="event-body">
                <h3 class="event-title">
                    {{event.title}}
                </h3>
                <p class="event-description">{{event.description | characters:100}}</p>
                <div ng-if="event.isCancelled" class="event-canceled-info">@L("ThisEventIsCanceled")</div>
                <div class="event-registration-info">
                    <span ng-if="event.registrationsCount < event.maxRegistrationCount">
                        @L("XofYregistered", "{{event.registrationsCount}}", "{{event.maxRegistrationCount}}")
                    </span>
                    <span ng-if="event.maxRegistrationCount > 0 && event.registrationsCount >= event.maxRegistrationCount">
                        @L("XregisteredNoNewRegistrationAvailable", "{{event.registrationsCount}}")
                    </span>
                    <span ng-if="event.maxRegistrationCount <= 0">
                        @L("XregisteredUnlimitedRegistrations", "{{event.registrationsCount}}")
                    </span>
                </div>
                <div class="event-actions">
                    <a class="btn btn-sm btn-info" ng-href="#/events/{{event.id}}">@L("Details") <i class="fa fa-arrow-circle-right"></i></a>
                </div>
                <span class="event-date"><i class="fa fa-calendar-times-o"></i> {{event.date | momentFormat:'DD.MM.YYYY'}}</span>
            </div>
        </div>
    </div>
</div>